From: Marco Trevisan (TreviƱo) Date: Wed, 1 May 2024 20:34:58 +0000 (+0200) Subject: tray/na-xembed: Use XShape to remove input on socket window X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~104^2^2~57 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=2e97a453290983a3f634153b86a560660896421b;p=gnome-shell.git tray/na-xembed: Use XShape to remove input on socket window We don't want this window to take any input as, a part from blocking the events on the shell representation itself, they may potentially make the plugged window to do anything with the event is processing (such as showing tooltips). And we don't want this since we only want to send to those windows only the synthetic events that we explicitly control. This was already the case before of commit ab60902058 but a similar approach was not replicated, leading to input events being fully processed from tray icons plugs. It requires adding an explicit build dependency on Xext, but this is something that mutter already depends on so not really a new dependency Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7613 Part-of: --- diff --git a/meson.build b/meson.build index b4f8058b9..2f257d6a4 100644 --- a/meson.build +++ b/meson.build @@ -92,6 +92,7 @@ have_x11 = mutter_dep.get_variable('have_x11') == 'true' have_x11_client = mutter_dep.get_variable('have_x11_client') == 'true' if have_x11_client or have_x11 x11_dep = dependency('x11') + xext_dep = dependency('xext') xfixes_dep = dependency('xfixes') endif diff --git a/src/tray/meson.build b/src/tray/meson.build index 2fc73f3a4..c91e94044 100644 --- a/src/tray/meson.build +++ b/src/tray/meson.build @@ -9,6 +9,6 @@ tray_sources = [ libtray = static_library('tray', tray_sources, c_args: ['-DG_LOG_DOMAIN="notification_area"'], - dependencies: [mutter_dep, mtk_dep, xfixes_dep], + dependencies: [mutter_dep, mtk_dep, xfixes_dep, xext_dep], include_directories: conf_inc ) diff --git a/src/tray/na-xembed.c b/src/tray/na-xembed.c index 75af21adb..1a9193974 100644 --- a/src/tray/na-xembed.c +++ b/src/tray/na-xembed.c @@ -24,6 +24,7 @@ #include "na-xembed.h" #include +#include #include #include #include @@ -362,6 +363,7 @@ na_xembed_add_window (NaXembed *xembed, { XSetWindowAttributes socket_attrs; XWindowAttributes plug_attrs; + int shape_major, shape_minor; int result; result = XGetWindowAttributes (xdisplay, priv->plug_window, &plug_attrs); @@ -407,6 +409,19 @@ na_xembed_add_window (NaXembed *xembed, priv->plug_window, priv->socket_window, 0, 0); + + /* Set an empty input shape on the window so that the socket does not + * get any input. Without this the tray may still get events and - for + * instance - show tooltips on hover which we don't want. + * This is the quickest way to achieve this, without having to deal these + * windows with specific code in mutter. + */ + if (XShapeQueryExtension (xdisplay, &shape_major, &shape_minor)) + { + XShapeSelectInput (xdisplay, priv->socket_window, NoEventMask); + XShapeCombineRectangles (xdisplay, priv->socket_window, ShapeInput, + 0, 0, NULL, 0, ShapeSet, 0); + } } priv->have_size = FALSE;